package com.wrupple.muba.catalogs.client.events;

import java.util.List;

import com.google.gwt.core.client.JavaScriptObject;
import com.google.gwt.event.shared.GwtEvent;

public class DataSelectionEvent extends GwtEvent<DataSelectionHandler> {

	public static final Type<DataSelectionHandler> TYPE = new Type<DataSelectionHandler>();
	private String dataType;
	private List<? > result;

	public DataSelectionEvent(List<? > result, String type) {
		this.result=result;
		this.dataType=type;
	}

	@Override
	public com.google.gwt.event.shared.GwtEvent.Type<DataSelectionHandler> getAssociatedType() {
		return TYPE;
	}

	@Override
	protected void dispatch(DataSelectionHandler handler) {
		handler.onDataSelection(this);
	}

	public String getDataType() {
		return dataType;
	}

	public List<? > getResult() {
		return result;
	}

	public <T extends JavaScriptObject> List<T> getResultAndCast() {
		return (List<T>) result;
	}
	
	

}
